<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak={:config('site.configgroup')['baidu_ak']}"></script>
    <script>
        var form_lat={$row.lat|htmlentities};
        var form_lng={$row.lng|htmlentities};
        var building_id = {$row.id};
    </script>
    <style>
        input.input-short{width:80px !important}
        td.mf-td-title{vertical-align: middle !important;}
    </style>
    <div>
        <!-- Nav tabs -->
        <ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">基本信息</a></li>
            <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">楼盘介绍</a></li>
            <li role="presentation"><a href="#picture" aria-controls="picture" role="tab" data-toggle="tab">封面图片</a></li>            
            {volist name="buildingPictureType" id="vo"}
            <li role="presentation"><a href="#type_{$vo->id}" aria-controls="type_{$vo->id}" role="tab" data-toggle="tab">{$vo->type_name}</a></li>
            {/volist}
        </ul>
    
        <!-- Tab panes -->
        <div class="tab-content">
        <div role="tabpanel" class="tab-pane active" id="home">
            <table class="table">
                <tr>
                    <td>
                        <table class="table table-borderd">
                            <tr>
                                <td class="mf-td-title">{:__('Building_name')}:</td>
                                <td class="mf-td-input"><input id="c-building_name" data-rule="required"  class="form-control input-middle" name="row[building_name]" type="text" value="{$row.building_name|htmlentities}" style="width:80%"><a href="javascript:;" class="link-map">定位</a></td>
                                <td class="mf-td-title" >{:__('Area')}:</td>
                                <td class="mf-td-input" style="position:relative;"> 
                                        <input id="c-area" class="form-control" style="width:200px"  data-toggle="city-picker" name="row[area]" value="{$row.area|htmlentities}"></td>   
                                <td class="mf-td-title">经纬度:</td>
                                <td class="mf-td-input">
                                        <input id="c-lng" class="form-control input-short" name="row[lng]" type="number" style="width:100px" value="{$row.lng|htmlentities}">
                                        <label>-</label>
                                        <input id="c-lat" class="form-control input-short" name="row[lat]" type="number" style="width:100px" value="{$row.lat|htmlentities}">
                                </td>
                            </tr>
                            <tr>
                                <td class="mf-td-title">{:__('Address')}:</td>
                                <td class="mf-td-input"><input id="c-address" class="form-control input-middle" name="row[address]" type="text" value="{$row.address|htmlentities}"></td>
                                <td class="mf-td-title">是否置顶:</td>
                                <td class="mf-td-input"><label><input type="radio" name="row[is_top]" value="1" {$row.is_top?"checked":""} />置顶</label> <label><input name="row[is_top]" type="radio" value="0" {$row.is_top?"":"checked"} />不置顶</label></td>
                                <td class="mf-td-title">工作时间:</td>
                                <td class="mf-td-input"> 
                                    <input id="c-work_begin"  class="form-control input-short datetimepicker" name="row[work_begin]" data-date-format="HH:mm:ss" data-use-current="true" name="row[work_begin]" type="text"  value="{$row.work_begin}"  style="width:100px">
                                    <label>-</label>
                                    <input id="c-work_end" class="form-control input-short datetimepicker" data-date-format="HH:mm:ss" data-use-current="true" name="row[work_end]" type="text" value="{$row.work_end}" style="width:100px">
                                </td>
                            </tr>
                            <tr>
                                <td class="mf-td-title">标签:</td>
                                <td class="mf-td-input" colspan="3"><input type="text" name="row[labels]" data-source="newhouse/building/labels/index" data-primary-key="id" data-field="label_name"  data-multiple="true" class="form-control selectpage" value="{$row.labels}" /> </td>   
                                <td class="mf-td-title">开发商账号:</td>
                                <td class="mf-td-input"><input type="text" name="row[developer_adminid]" data-source="auth/admin/selectlist" data-primary-key="id" data-field="username" data-multiple="false" class="form-control selectpage" value="{$row.developer_adminid|htmlentities}" /> </td>
                            </tr>
                            <tr>
                                <td class="mf-td-title">{:__('Contact_tel')}:</td>
                                <td class="mf-td-input"><input id="c-contact_tel"  class="form-control input-middle" name="row[contact_tel]" type="text" value="{$row.contact_tel|htmlentities}"></td>
                                <td class="mf-td-title">{:__('Validate_begin')}:</td>
                                <td class="mf-td-input">
                                    <input id="c-validate_begin" class="form-control input-middle datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[validate_begin]" type="text" value="{$row.validate_begin}"  style="width:120px">
                                    <label>-</label>
                                    <input id="c-validate_end" class="form-control input-middle datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[validate_end]" type="text" value="{$row.validate_end}"  style="width:120px">
                                </td>
                                <td>代理商账号:</td>
                                <td class="mf-td-title"><input type="text" name="row[agent_adminid]" data-source="auth/admin/selectlist" data-primary-key="id" data-field="username" data-multiple="false" class="form-control selectpage" value="{$row.agent_adminid|htmlentities}" /> </td>
                            </tr>
                            <tr>
                                <td class="mf-td-title">{:__('Last_sell')}:</td>
                                <td class="mf-td-input"><input id="c-last_sell" class="form-control input-middle datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[last_sell]" type="text" value="{$row.last_sell}"></td>
                                <td class="mf-td-title">{:__('Get_date')}:</td>
                                <td class="mf-td-input"> <input id="c-get_date" class="form-control input-middle datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[get_date]" type="text" value="{$row.get_date}"></td>   
                                <td class="mf-td-title">{:__('Property_year')}:</td>
                                <td class="mf-td-input">  <input id="c-property_year" class="form-control input-middle" name="row[property_year]" type="number"  value="{$row.property_year|htmlentities}"></td>   
                            </tr>
                            
                            <tr>
                                <td class="mf-td-title">{:__('Volume_ratio')}:</td>
                                <td class="mf-td-input"> <input id="c-volume_ratio" class="form-control input-middle" name="row[volume_ratio]" type="number" value="{$row.volume_ratio|htmlentities}"></td>
                                <td class="mf-td-title">{:__('Property_fee')}:</td>
                                <td class="mf-td-input"> <input id="c-property_fee" class="form-control input-middle" name="row[property_fee]" type="number" value="{$row.property_fee|htmlentities}"></td> 
                                <td class="mf-td-title">{:__('Greening_rate')}:</td>
                                <td class="mf-td-input"><input id="c-greening_rate" class="form-control input-middle" name="row[greening_rate]" type="number" value="{$row.greening_rate|htmlentities}"></td>
                            </tr>
                            <tr>
                                <td class="mf-td-title">{:__('Parking_spaces')}:</td>
                                <td class="mf-td-input">  <input id="c-parking_spaces" class="form-control input-middle" name="row[parking_spaces]" type="number" value="{$row.parking_spaces|htmlentities}"></td>   
                                <td class="mf-td-title">{:__('House_quantity')}:</td>
                                <td class="mf-td-input"><input id="c-house_quantity" class="form-control input-middle" name="row[house_quantity]" type="number" value="{$row.house_quantity|htmlentities}"></td>
                                <td class="mf-td-title">{:__('Developer')}:</td>
                                <td class="mf-td-input"> <input id="c-developer" class="form-control input-middle" name="row[developer]" type="text" value="{$row.developer|htmlentities}"></td>   
                            </tr>
                            <tr>
                                <td class="mf-td-title">{:__('Property_company')}:</td>
                                <td class="mf-td-input"><input id="c-property_company" class="form-control input-middle" name="row[property_company]" type="text" value="{$row.property_company|htmlentities}"></td>
                                <td class="mf-td-title">{:__('Scene_person')}:</td>
                                <td class="mf-td-input">  <input id="c-scene_person" class="form-control input-middle" name="row[scene_person]" type="text" value="{$row.scene_person|htmlentities}"></td>   
                                <td class="mf-td-title">{:__('Scene_person_tel')}:</td>
                                <td class="mf-td-input"><input id="c-scene_person_tel"  class="form-control input-middle" name="row[scene_person_tel]" type="text" value="{$row.scene_person_tel|htmlentities}"></td>
                            </tr>
                            <tr>
                                <td class="mf-td-title">{:__('Average_price')}:</td>
                                <td class="mf-td-input"><input id="c-average_price"  class="form-control input-middle" name="row[average_price]" type="number" value="{$row.average_price|htmlentities}"></td>
                                <td class="mf-td-title">{:__('Reporting_policy')}:</td>
                                <td class="mf-td-input" colspan="3"><input id="c-reporting_policy" class="form-control input-long" name="row[reporting_policy]" type="text" value="{$row.reporting_policy|htmlentities}"></td>   
                            </tr>

                            <tr>
                                <td class="mf-td-title">{:__('On_selling')}:</td>
                                <td class="mf-td-input" colspan="3"> <textarea id="c-on_selling" class="form-control " rows="5" name="row[on_selling]" cols="50">{$row.on_selling|htmlentities}</textarea></td>
                            </tr>
                        </table>
                    </td>
                    <td style="width:300px">
                        <div id="cop-map-container" style="height:410px;width:310px" class="margin"></div> 
                        <fieldset>
                            <legend>佣金政策</legend>
                            {volist name="buildingTypes" id="vo1" key="key"}
                            <div class="row">
                                <label><input type="checkbox" name="buildingTypesId[id_{$vo1.id}]" value="{$vo1.id}" {$vo1.has?"checked":""} />{$vo1.type_name}</label> 
                                <input name="buildingTypesPolicy_{$vo1.id}" class="form-control" style="width:150px" value="{$vo1.commission_policy}" placeholder="佣金政策" />
                                <label><input name="buildingTypesPrice_{$vo1.id}" class="form-control" style="width:100px" value="{$vo1.price}" placeholder="均价（万元）" />万元</label>
                            </div>
                            {/volist}
                        </fieldset>
                    </td>
                </tr>
            </table>
        </div>
        <div role="tabpanel" class="tab-pane" id="profile">
            <textarea id="c-introduction" class="form-control editor" name="row[introduction]" >{$row.introduction|htmlentities}</textarea>
        </div>
        <div role="tabpanel" class="tab-pane" id="picture">
            <div class="form-group">
                <div class="col-xs-2 col-sm-8 text-left">
                    <div class="input-group">
                        <input id="c-picture" name="row[picture]" class="form-control hide" type="hidden" value="{$row.picture}">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" id="plupload-picture" class="btn btn-danger plupload" data-input-id="c-picture" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-picture"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-picture" class="btn btn-primary fachoose" data-input-id="c-picture" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right" for="c-picture"></span>
                    </div>
                    <ul class="row list-inline plupload-preview" id="p-picture"></ul> 
                </div>
            </div>
        </div>
        {volist name="buildingPictureType" id="vo"}
        <div role="tabpanel" class="tab-pane" id="type_{$vo->id}">
            <div class="form-group">
                <div class="col-xs-12 col-sm-8" id="images-type-{$vo->id}">
                    <div class="input-group">
                        <input id="c-path-{$vo->id}" class="form-control hide" size="50" name="picture[path-{$vo->id}]" type="text" value="<?php echo $pictures['v_' . $vo->id] ?>">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" id="plupload-path-{$vo->id}" class="btn btn-danger plupload cropper" data-input-id="c-path-{$vo->id}" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-path-{$vo->id}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-path-{$vo->id}" class="btn btn-primary fachoose" data-input-id="c-path-{$vo->id}" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right" for="c-path-{$vo->id}"></span>
                    </div>
                    <ul class="row list-inline plupload-preview setpicture" id="p-path-{$vo->id}"></ul>
                </div>
            </div>
        </div>
        {/volist}
        </div>
    
    </div>
    
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
